package com.standardoperationapp.net;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import io.reactivex.observers.DisposableObserver;
import okhttp3.MultipartBody;
import okhttp3.ResponseBody;

public class MaterialApi {

    public static void getPurchasePlanMark(DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getPurchasePlanMark();
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void getPurchaseApp(String planMark, String planName, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getPurchaseApp(planMark,planName);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void getPurchaseDetailsApp(int id, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getPurchaseDetailsApp(id);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void savePurchaseDetailsApp(Map<String, Object> map, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().savePurchaseDetailsApp(map);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void submitPurchaseDetailsApp(Map<String, Object> map, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().submitPurchaseDetailsApp(map);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }


    public static void getInboundBatchNumList(DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getInboundBatchNumList();
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void getMatRepertoryBatchNumList(DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getMatRepertoryBatchNumList();
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void getMatRepertoryList(String batchNum, String name, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getMatRepertoryList(batchNum, name);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void getMatRepertoryById(int id, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getMatRepertoryById(id);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void saveMatRepertory(Map<String, Object> map, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().saveMatRepertory(map);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void submitMatRepertory(Map<String, Object> map, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().submitMatRepertory(map);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }


    // returnApp  0-入库 1-出库
    public static void getMatCannibaBatchNumList(int returnApp, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi()
                .getMatCannibaBatchNumList(returnApp);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void getMatCanniba(String batchNum, String name,DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getMatCanniba(batchNum, name);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void getMatCannibaById(int id, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getMatCannibaById(id);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void saveMatCanniba(Map<String, Object> map, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().saveMatCanniba(map);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void submitMatCanniba(Map<String, Object> map, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().submitMatCanniba(map);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }


    // 报废-获取批次列表
    // returnApp  0-入库 1-出库
    public static void getScrapBatchNumList(int returnApp, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi()
                .getScrapBatchNumList(returnApp);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void scrapFindList(String id, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().scrapFindList(id);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void saveScrap(Map<String, Object> map, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().saveScrap(map);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void submitScrap(Map<String, Object> map, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().submitScrap(map);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }


    public static void getMatInventoryType(DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi()
                .getMatInventoryType();
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void getMatInventoryTaskList(int inventTypeId, int pageNum, int pageSize, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi()
                .getMatInventoryTaskList(inventTypeId, pageNum, pageSize);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void getMatInventoryTaskStockList(int id, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getMatInventoryTaskStockList(id);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void getMatInventoryTaskStockById(int id, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getMatInventoryTaskStockById(id);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void saveMatInventoryTaskStock(List map, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().saveMatInventoryTaskStock(map);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void submitMatInventoryTaskStock(List map, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().submitMatInventoryTaskStock(map);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }

    public static void getMatInventoryTaskOnsiteList(int id, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getMatInventoryTaskOnsiteList(id);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void getMatInventoryTaskOnsiteById(int id, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getMatInventoryTaskOnsiteById(id);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void saveMatInventoryTaskOnsite(List map, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().saveMatInventoryTaskOnsite(map);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void submitMatInventoryTaskOnsite(List map, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().submitMatInventoryTaskOnsite(map);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }


    public static void getMatConsumerBatchNumList(DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getMatConsumerBatchNumList();
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void getMatConsumerDetailById(int id, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getMatConsumerDetailById(id);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void saveMatConsumerRecord(Map<String, Object> map, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().saveMatConsumerRecord(map);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void submitMatConsumerRecord(Map<String, Object> map, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().submitMatConsumerRecord(map);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }


    public static void uploadFile(MultipartBody.Part file,DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().uploadFile(file);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }


    public static void getAppRfidCodeList(DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getAppRfidCodeList();
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void getMatInfoByRfid(String rfidCode, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi().getMatInfoByRfid(rfidCode);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
    public static void updateAppRfidCodeStatus(String rfidCode, String rfidStatus, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi()
                .updateAppRfidCodeStatus(rfidCode, rfidStatus);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }
}
